<table id="tabla" class="tabla" width="100%">
    <thead>
        <tr>
            <th>Nombre</th>
            <th>Primer apellido</th>
            <th>Departamento</th>
            <th>Municipio </th>
            <th> </th>
            <th> </th>
            <th colspan="1"></th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($User as $usuario): ?>
            <?php
            App::import('model', 'UserCity');
            $UserCity = new UserCity();
            $UserCity->recursive = -1;
            $cont = $UserCity->find('count', array('conditions' => array('UserCity.city_id' => $usuario['City']['id'])));
            $color = "";
            if ($cont > 1) {
                $color = 'style="background-color: tomato"';
            }
            ?>    
            <tr <?php echo $color ?>>

                <td><?php echo $usuario['User']['nombre'] ?></td>
                <td><?php echo $usuario['User']['primer_apellido'] ?></td>
                <td><?php echo $usuario['Departament']['nombre'] ?></td>
                <td><?php echo $usuario['City']['nombre'] ?></td>
                <td><?php echo $usuario['Branch']['nombre'] ?></td>
                <td><?php if ($usuario['User']['finalizado'] == 1) echo "Finalizado"; else echo "sin finalizar"; ?></td>
                <td>
                    <?php echo $this->Ajax->link("Ver", array('class' => "actions", 'controller' => "Users", "action" => "view", $usuario['User']['id']), array('update' => 'content','class'=>'actions')) ?>
                    <br>
                    <br>
                    <?php echo $this->Ajax->link("Eliminar", array('class' => "actions", 'controller' => "Users", "action" => "delete", $usuario['User']['id'],1), array('class'=>'actions', 'update' => 'content'),'¿Desea  eliminar el registro?') ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php
echo "<br>";
echo $this->Html->link("salir", array('model' => 'User', "action" => "logout"))
?>